Initial Power Measurement Data Analysis¶

In [1]:
import pandas as pd

# Graphing module imports
import plotly.graph_objects as go
import plotly.express as px
import plotly.io as pio
pio.renderers.default='notebook'
from plotly.subplots import make_subplots
In [2]:
df1 = pd.read_csv('data/powermeter_04042023.txt', header=None, parse_dates = [1], sep = '\t', names = ['power', 'time'])

Power measurement from circuit¶

In [3]:
df1
Out[3]:
power time
0 47.632253 2023-04-04 19:15:24.575
1 19.412814 2023-04-04 19:15:24.678
2 19.920822 2023-04-04 19:15:24.939
3 21.040369 2023-04-04 19:15:26.431
4 46.876473 2023-04-04 19:15:26.554
... ... ...
1647 118.288227 2023-04-04 19:18:13.760
1648 105.578659 2023-04-04 19:18:13.862
1649 50.392134 2023-04-04 19:18:13.963
1650 105.835308 2023-04-04 19:18:14.064
1651 124.688335 2023-04-04 19:18:14.192

1652 rows × 2 columns

In [4]:
with open('data/smipower_04042023.txt') as f:
    data = f.readlines()
    
data = [eval(x.strip()) for x in data]
data = [{'power': x['Power'].strip(), 'time': x['Time']} for x in data]
df2 = pd.DataFrame(data)
df2['time'] = pd.to_datetime(df2['time'])
df2['power'] = pd.to_numeric(df2['power'])

Power measurement from nvidia-smi¶

In [5]:
df2
Out[5]:
power time
0 26.99 2023-04-04 19:15:22.309
1 26.99 2023-04-04 19:15:22.445
2 27.23 2023-04-04 19:15:22.564
3 27.23 2023-04-04 19:15:22.685
4 27.23 2023-04-04 19:15:22.808
... ... ...
1146 158.98 2023-04-04 19:18:13.587
1147 150.63 2023-04-04 19:18:13.730
1148 145.75 2023-04-04 19:18:13.887
1149 131.96 2023-04-04 19:18:14.057
1150 107.88 2023-04-04 19:18:14.230

1151 rows × 2 columns

In [6]:
fig = make_subplots(rows=2, cols=1)
fig.add_trace(go.Scatter(x=df1['time'], y=df1['power'], mode='lines'), row=1, col=1)
fig.add_trace(go.Scatter(x=df1['time'], y=df1['power'], mode='markers'), row=2, col=1)
#fig.update_xaxes(rangeslider_visible=True)
fig.show()
In [7]:
fig = make_subplots(rows=2, cols=1)
fig.add_trace(go.Scatter(x=df2['time'], y=df2['power'], mode='lines'), row=1, col=1)
#fig.add_trace(go.Scatter(x=df1['time'], y=df1['power'], mode='lines'), row=2, col=1)
fig.update_xaxes(rangeslider_visible=True)
fig.show()

Combined power measurements from both sources¶

In [8]:
pieces = {'meter': df1, 'smi': df2}
df_concate = pd.concat(pieces, names=['source'])
df_concate = df_concate.reset_index(level=0)
df_concate
Out[8]:
source power time
0 meter 47.632253 2023-04-04 19:15:24.575
1 meter 19.412814 2023-04-04 19:15:24.678
2 meter 19.920822 2023-04-04 19:15:24.939
3 meter 21.040369 2023-04-04 19:15:26.431
4 meter 46.876473 2023-04-04 19:15:26.554
... ... ... ...
1146 smi 158.980000 2023-04-04 19:18:13.587
1147 smi 150.630000 2023-04-04 19:18:13.730
1148 smi 145.750000 2023-04-04 19:18:13.887
1149 smi 131.960000 2023-04-04 19:18:14.057
1150 smi 107.880000 2023-04-04 19:18:14.230

2803 rows × 3 columns

In [9]:
# A plot comparing SMI and meter measurements directly
# An interesting figure if SMI output and meter readings captured together

fig = px.line(df_concate, x='time', y='power', color='source')
fig.update_xaxes(rangeslider_visible=True)
fig.show()